﻿<Window x:Class="ProverbTeleprompter.ToolsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Controls="clr-namespace:ProverbTeleprompter.Controls" 
        xmlns:Converters="clr-namespace:ProverbTeleprompter.Converters" mc:Ignorable="d"
        AllowsTransparency="False"
		Background="Black"
             WindowStartupLocation="Manual"
        x:Name="TheToolWindow"
        Title="Proverb TelePrompter" Height="250"  d:DesignHeight="263" d:DesignWidth="1331" SizeToContent="Width"  ShowInTaskbar="True" Icon="ProverbTeleprompterLogo.ico">
    <Window.Resources>

        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Resources/Resources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid x:Name="ToolsGrid" VerticalAlignment="Stretch"
              Background="Transparent" Margin="0,0,0,0" Grid.RowSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
    
                </Grid.ColumnDefinitions>

             
                <Label  Content="Proverb Teleprompter"  FontSize="21.333" Foreground="White" 
				FontWeight="Bold" VerticalAlignment="Bottom" HorizontalAlignment="Center" >
                    <Label.Effect>
                        <DropShadowEffect Color="Gray" BlurRadius="2" ShadowDepth="2"/>
                    </Label.Effect>
                </Label>
            </Grid>

            <Border Grid.Row="1" x:Name="ToolBorder" Background="Black" >
                <ScrollViewer  Margin="10,5" MinHeight="170" Focusable="False" VerticalScrollBarVisibility="Auto">
                    <WrapPanel x:Name="ToolsPanel" Orientation="Horizontal" UseLayoutRounding="False"  
                		ScrollViewer.CanContentScroll="True">
                		<WrapPanel  Orientation="Vertical"  Style="{StaticResource ResourceKey=ToolSection}">
                			<RadioButton x:Name="BlackOnWhiteButton" GroupName="Color" Content="Black on White" 
                				IsChecked="{Binding IsBlackOnWhite, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                				Focusable="False" Margin="3" ToolTip="Black text on white background"/>
                			<RadioButton x:Name="WhiteOnBlackButton" GroupName="Color" Content="White on Black" 
                				IsChecked="{Binding IsWhiteOnBlack, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                				Focusable="False" Margin="3" ToolTip="White text on black background" />
                			<CheckBox Content="Edit Inline" Height="16" x:Name="EditableCheckbox" Focusable="False" 
                				IsChecked="{Binding Editable, Mode=TwoWay}"
                				Margin="2" ToolTip="Edit the text directly in the prompter window" />
                			<Button Content="Edit in WordPad" ToolTip="Edit the document in WordPad" Focusable="False" Height="20" x:Name="EditInWordpadButton" 
                				Style="{DynamicResource ToolButtonStyle}" Width="95.104" 
                				Command="{Binding EditInWordpadCommand}"/>
                		</WrapPanel>
                		<WrapPanel Orientation="Vertical" Style="{StaticResource ResourceKey=ToolSection}">
                			<Label Content="Font Size"  />
                			<Slider x:Name="FontSizeSlider" Value="{Binding FontSize, FallbackValue=24}" Maximum="192" Minimum="12" 
                				LargeChange="12" TickPlacement="BottomRight" 
                				TickFrequency="12" SmallChange="12" IsSnapToTickEnabled="True" 
                				Focusable="False" RenderTransformOrigin="0.574,0.443" ToolTip="Set the font size (applied to all text)" />
                			<TextBox  x:Name="FontSizeTextBox" Margin="13,0" HorizontalContentAlignment="Center" MouseLeftButtonDown="SpeedTextBox_MouseLeftButtonDown"
                				Text="{Binding Value, Converter={Converters:StringToFloatConverter Max=192, Min=12}, ElementName=FontSizeSlider, Mode=TwoWay}" Focusable="False"  
                				Background="Transparent" BorderBrush="Transparent"
                				VerticalAlignment="Top" HorizontalAlignment="Center" Width="32" ToolTip="Click to type in the font size"  />
                			<Path Data="M8.7566667,146.43067 L33.304834,146.43067" Fill="#FF010101" Height="3" Stretch="Fill" Width="74.149" Stroke="Black" StrokeThickness="0.5"/>
                            
                			<Label Content="Line Height"  />
                			<Slider x:Name="LineHeightSlider" Value="{Binding LineHeight, FallbackValue=1}" Maximum="3" Minimum="1" 
                				LargeChange="0.1" TickPlacement="BottomRight" 
                				TickFrequency="0.05" IsSnapToTickEnabled="True" 
                				Focusable="False" ToolTip="Set the text line height" />
                			<TextBox  x:Name="LineHeightTextBox" Margin="13,0" HorizontalContentAlignment="Center" MouseLeftButtonDown="SpeedTextBox_MouseLeftButtonDown"
                				Text="{Binding Value, Converter={Converters:StringToFloatConverter Max=3, Min=1}, ElementName=LineHeightSlider, Mode=TwoWay}" Focusable="False"  
                				Background="Transparent" BorderBrush="Transparent"
                				VerticalAlignment="Top" HorizontalAlignment="Center" Width="32" ToolTip="Click to type in the line height"  />

                		</WrapPanel>
                		<WrapPanel Orientation="Vertical"  Style="{StaticResource ResourceKey=ToolSection}" Width="122">

                			<Label Content="Scroll Speed" d:LayoutOverrides="Height" />
                			<Slider x:Name="SpeedSlider" ToolTip="Set the current scrolling speed"  
                				Value="{Binding SpeedSliderValue, FallbackValue=1, Mode=TwoWay}" 
                				Maximum="{Binding SpeedMax, FallbackValue=8, Mode=OneWay}" 
                				Minimum="{Binding SpeedMin, FallbackValue=-8, Mode=OneWay}" LargeChange="1" Focusable="False"
                				TickPlacement="BottomRight" TickFrequency="0.5" SmallChange="0.05"  
                				VerticalAlignment="Top" HorizontalAlignment="Stretch"  Width="122" />
                			<TextBox x:Name="SpeedTextBox" BorderBrush="Transparent" Background="Transparent" 
                				HorizontalAlignment="Center"  HorizontalContentAlignment="Center"
                				Text="{Binding Value, Converter={StaticResource StringToFloatConverter}, ElementName=SpeedSlider, Mode=TwoWay, StringFormat=\{0:F\}}" 
                				Focusable="False" VerticalAlignment="Bottom" MouseLeftButtonDown="SpeedTextBox_MouseLeftButtonDown" ToolTip="Click to type in the scroll speed" />
                			                			<ToggleButton x:Name="PausedCheckbox" IsChecked="{Binding Paused}" Focusable="False" 
                				Content="ToggleButton" HorizontalAlignment="Center" Height="40.282" Margin="3,19,3,3"
                				Style="{DynamicResource PlayPauseStyle}" VerticalAlignment="Bottom" Width="44" ToolTip="Toggle Play/Pause (Space/F5/ESC)"/>

                		</WrapPanel>
                		<WrapPanel Orientation="Vertical"  Style="{StaticResource ResourceKey=ToolSection}">
                			<Button Content="Load Document" Margin="5"  x:Name="LoadFileButton"  Focusable="False"
                				Command="{Binding LoadDocumentCommand}"
                				Style="{DynamicResource ToolButtonStyle}" />
                			<Button Content="Save Text" x:Name="SaveButton" 
                				Margin="5"
                				Command="{Binding SaveDocumentCommand}"
                				Focusable="False" Style="{DynamicResource ToolButtonStyle}" />
                			<Button Content="Save Text As..." x:Name="SaveAsButton" Focusable="False"
                				Margin="5" 
                				Command="{Binding SaveDocumentAsCommand}"
                				Style="{DynamicResource ToolButtonStyle}" RenderTransformOrigin="0.696,0.483" />

                		</WrapPanel>
                		<WrapPanel Orientation="Vertical"  Style="{StaticResource ResourceKey=ToolSection}">
                			<Button Content="{Binding ToggleTalentWindowCaption, FallbackValue=Show Talent Window}"
									ToolTip="Display a second window for external monitors" 
                				x:Name="ToggleTalentWindowButton" Focusable="False"
                				Margin="5,5,5,2" 
                				Command="{Binding ToggleTalentWindowCommand}"
                				Style="{DynamicResource ToolButtonStyle}" />
							<TextBlock Text="Monitor for Talent Window:" Margin="5,0" />
							<ComboBox Margin="5,0" Focusable="False" ItemsSource="{Binding Displays}" 
									  IsEnabled="{Binding MultipleMonitorsAvailable}"
									  SelectedItem="{Binding SelectedTalentWindowDisplay}"
									  Controls:Selected.Command="{Binding TalentWindowsDisplaySelectedCommand}"/>
							<CheckBox Content="Full screen talent Window" IsChecked="{Binding FullScreenTalentWindow}"
                				Height="16" x:Name="FullScreen" Focusable="False" Margin="5,0" />
                			<CheckBox Content="Flip Talent Window Vertically" IsChecked="{Binding FlipTalentWindowVert}"
                				Height="16" x:Name="FlipTalentWindowVertCheckBox" Focusable="False" Margin="5,0" />
                			<CheckBox Content="Flip Talent Window Horizontally" IsChecked="{Binding FlipTalentWindowHoriz}"
                				Height="16" x:Name="FlipTalentWindowHorizCheckBox" Focusable="False" Margin="5,0" BorderThickness="1,0" />
                			<CheckBox Content="Flip Main Window Vertically" Height="16" IsChecked="{Binding FlipMainWindowVert}"
                				x:Name="FlipMainWindowVertCheckBox" Focusable="False" Margin="5,0" />
                			<CheckBox Content="Flip Main Window Horizontally" Height="16" IsChecked="{Binding FlipMainWindowHoriz}"
                				x:Name="FlipMainWindowHorizCheckBox" Focusable="False" Margin="5,0" />
                			<CheckBox Content="Receive Global Keystrokes " 
                				x:Name="checkBox1" IsChecked="{Binding ReceiveGlobalKeystrokes}" 
                				Width="180.8"
                				ContentTemplate="{DynamicResource WrappingTextStyle}" ToolTip="The Prompter App will get keystrokes regardless of whether or not it has focus"
								 Margin="5,0,0,-1" HorizontalAlignment="Left" FontWeight="Bold" FontSize="12" Focusable="False" />
                		</WrapPanel>
                		<WrapPanel Orientation="Vertical"  Style="{StaticResource ResourceKey=ToolSection}">
                			<Label Content="Percent Complete" HorizontalAlignment="Center" FontSize="16" FontWeight="Bold" />
                			<TextBox x:Name="PercentComplete" 
                				Text="{Binding PercentComplete, StringFormat=\{0:F\}%}"
                				IsReadOnly="True" FontSize="26.667" 
                				FontWeight="Bold" Focusable="False" Margin="5" MaxLength="7" 
                				HorizontalContentAlignment="Center" ToolTip="The amount of the document that has been scrolled" />
                			<Label Content="Time Left" HorizontalAlignment="Center" FontSize="16" FontWeight="Bold" />
                			<TextBox x:Name="Eta" 
                				Text="{Binding TimeRemaining, StringFormat=\{0\}}"
                				ToolTip="The estimated time until the end of the document is reached (At the current speed)" IsReadOnly="True" FontSize="26.667" 
                				FontWeight="Bold" Focusable="False" Margin="5" 
                				HorizontalContentAlignment="Center" MaxLength="8" />
                		</WrapPanel>

						<WrapPanel Orientation="Vertical" Style="{StaticResource ResourceKey=ToolSection}">
							<Label Content="Outer Margin"  />
							<Slider x:Name="OuterLeftRightMarginSlider" Value="{Binding OuterLeftRightMarginValue, FallbackValue=24}" Maximum="300" Minimum="0" 
                				LargeChange="25" TickPlacement="BottomRight" 
                				TickFrequency="25" SmallChange="1" IsSnapToTickEnabled="False" 
                				Focusable="False" RenderTransformOrigin="0.574,0.443" ToolTip="Left and Right Outer Margin" />
							<TextBox  x:Name="OuterLeftRightMarginTextBox" Margin="13,0" HorizontalContentAlignment="Center" MouseLeftButtonDown="SpeedTextBox_MouseLeftButtonDown"
                				Text="{Binding Value, Converter={Converters:StringToFloatConverter Max=300, Min=0}, ElementName=OuterLeftRightMarginSlider, Mode=TwoWay}" Focusable="False"  
                				Background="Transparent" BorderBrush="Transparent"
                				VerticalAlignment="Top" HorizontalAlignment="Center" Width="32" ToolTip="Click to type in the outer margin size"  />
							<Path Data="M8.7566667,146.43067 L33.304834,146.43067" Fill="#FF010101" Height="3" Stretch="Fill" Width="74.149" Stroke="Black" StrokeThickness="0.5"/>

							<Label Content="Text Margin"  />
							<Slider x:Name="TextMarginSlider" Value="{Binding TextMarginValue, FallbackValue=24}" Maximum="300" Minimum="0" 
                				LargeChange="25" TickPlacement="BottomRight" 
                				TickFrequency="25" SmallChange="1" IsSnapToTickEnabled="False" 
                				Focusable="False" RenderTransformOrigin="0.574,0.443" ToolTip="Text Margin" />
							<TextBox  x:Name="TextMarginTextBox" Margin="13,0" HorizontalContentAlignment="Center" MouseLeftButtonDown="SpeedTextBox_MouseLeftButtonDown"
                				Text="{Binding Value, Converter={Converters:StringToFloatConverter Max=300, Min=0}, ElementName=TextMarginSlider, Mode=TwoWay}" Focusable="False"  
                				Background="Transparent" BorderBrush="Transparent"
                				VerticalAlignment="Top" HorizontalAlignment="Center" Width="32" ToolTip="Click to type in the text margin"  />

						</WrapPanel>

						<WrapPanel Orientation="Vertical" Style="{StaticResource ResourceKey=ToolSection}">
							<Label Content="Eye Line Height"  />
							<Slider x:Name="EyelineHeightSlider" Value="{Binding EyelineHeight, FallbackValue=70}" Maximum="300" Minimum="0" 
                				LargeChange="25" TickPlacement="BottomRight" 
                				TickFrequency="25" SmallChange="1" IsSnapToTickEnabled="False" 
                				Focusable="False" RenderTransformOrigin="0.574,0.443" ToolTip="Height of the yellow eyeline marks" />
							
							<Label Content="Eye Line Width"  />
							<Slider x:Name="EyelineWidthSlider" Value="{Binding EyelineWidth, FallbackValue=50}" Maximum="300" Minimum="0" 
                				LargeChange="25" TickPlacement="BottomRight" 
                				TickFrequency="25" SmallChange="1" IsSnapToTickEnabled="False" 
                				Focusable="False" RenderTransformOrigin="0.574,0.443" ToolTip="Width of the yellow eyeline marks" />

						</WrapPanel>

						<WrapPanel Orientation="Vertical"  Style="{StaticResource ResourceKey=ToolSection}">
                			<Button Content="Set Bookmark" ToolTip="Set a Bookmark at the current eyeline position (INSERT key)" x:Name="AddBookmarkButton" Focusable="False"
                				Margin="5" Style="{DynamicResource ToolButtonStyle}" RenderTransformOrigin="2.149,-0.308" 
                				Command="{Binding SetBookmarkCommand}" />
                			<ListBox x:Name="BookmarksListbox" ItemsSource="{Binding Bookmarks}" ToolTip="Jump to a bookmark by clicking on it (Number keys 1-9)"  
                				Height="125.5" Width="144.8" Margin="5" IsTextSearchCaseSensitive="True" 
                				ItemTemplate="{DynamicResource DataTemplate1}" 
                				
                				
                				Focusable="False" ItemContainerStyle="{DynamicResource ListBoxItemStyle1}" ItemsPanel="{DynamicResource ItemsPanelTemplate1}" 
                                     
                                     />
							<!--
							SelectedItem="{Binding SelectedBookmark, Mode=TwoWay}"
							Controls:Selected.Command="{Binding BookmarkSelectedCommand}"-->
                		</WrapPanel>

                		<WrapPanel Orientation="Vertical"  Style="{StaticResource ResourceKey=ToolSection}">
                			<RichTextBox Background="Transparent" BorderBrush="Transparent" IsReadOnly="True" 
                				Focusable="False" FontSize="8" Width="150" Height="132.08">
                				<FlowDocument ColumnWidth="100" IsColumnWidthFlexible="False">
                					<Paragraph><Run FontWeight="Bold" Text="Keyboard:"/><LineBreak /><Run Text="↑/PGUP = quick scroll up"/><LineBreak /><Run Text="↓/PGDN = quick scroll down"/><LineBreak /><Run Text="TAB = Toggle show/hide tools"/><LineBreak /><Run Text="+ = Speed +"/><LineBreak /><Run Text="- = Speed -"/><LineBreak /><Run Text="Spacebar/F5/ESC = Play/Pause toggle"/><LineBreak /><Run Text=". (Period) = Restart"/><LineBreak /><Run Text="1 thru 9 = Jump to bookmark #"/><LineBreak /><Run Text="INSERT = Set bookmark"/><LineBreak /><Run Text="F1 = Load Random Bible Book"/><LineBreak /></Paragraph>
                				</FlowDocument>
                			</RichTextBox>
                		</WrapPanel>
                		<WrapPanel Orientation="Vertical"  Style="{StaticResource ResourceKey=ToolSection}">
                			<RichTextBox Background="Transparent" BorderBrush="Transparent" IsReadOnly="True" 
                				Focusable="False" FontSize="8" Width="150">
                				<FlowDocument ColumnWidth="100" IsColumnWidthFlexible="False">

                					<Paragraph><Run FontWeight="Bold" Text="Media Remote Buttons:"/><LineBreak /><Run Text="↑ = quick scroll up"/><LineBreak /><Run Text="↓ = quick scroll down"/><LineBreak /><Run Text="►► (Fast Forward) = Speed +"/><LineBreak /><Run Text="◄◄ (Rewind) = Speed -"/><LineBreak /><Run Text="|| (Pause) = Play/Pause toggle"/><LineBreak /><Run Text="► (Play) = Play"/><LineBreak /><Run Text="CH+ (Channel Up) = Page up"/><LineBreak /><Run Text="CH- (Channel Down) = Page down"/><LineBreak /><Run Text="|◄ (Prev Track) = Restart"/><LineBreak /></Paragraph>
                				</FlowDocument>
                			</RichTextBox>
                		</WrapPanel>

                	</WrapPanel>

                </ScrollViewer>
            </Border>

        </Grid>
     

    </Grid>
    
</Window>
